package net.wofly.finance.expense.validator;

import org.springframework.util.StringUtils;

import net.wofly.finance.expense.domain.ExpenseType;

public class ExpenseTypeValidator {
	/**
     * 换行符
     */
    private static String lineSeparator = System.getProperty("line.separator");
    
	public static String validateSaveExpenseTypeParams(ExpenseType expenseType) {
		StringBuffer stringBuffer = new StringBuffer();
		
		if (null == expenseType) {
		    stringBuffer.append("报销费用类型不能为空！").append(lineSeparator);
		    return stringBuffer.toString();
		}
		
		if (StringUtils.isEmpty(expenseType.getExpenseTypeName())) {
		    stringBuffer.append("报销费用类型名称不能为空！").append(lineSeparator);
		}
		
	    return stringBuffer.toString();
	}
	
	public static String validateUpdateExpenseTypeParams(ExpenseType expenseType) {
		StringBuffer stringBuffer = new StringBuffer();
		
		if (null == expenseType) {
		    stringBuffer.append("报销费用类型不能为空！").append(lineSeparator);
		    return stringBuffer.toString();
		}
		if (StringUtils.isEmpty(expenseType.getExpenseTypeID())) {
		    stringBuffer.append("报销费用类型ID不能为空！").append(lineSeparator);
		}
		
		if (StringUtils.isEmpty(expenseType.getExpenseTypeName())) {
		    stringBuffer.append("报销费用类型名称不能为空！").append(lineSeparator);
		}
		
	    return stringBuffer.toString();
	}
	
	public static String validateExpenseTypeIDParams(String expenseTypeID) {
		StringBuffer stringBuffer = new StringBuffer();
		
		if (StringUtils.isEmpty(expenseTypeID)) {
		    stringBuffer.append("报销费用类型ID不能为空！").append(lineSeparator);
		}
	    return stringBuffer.toString();
	}
	
	
	 

}
